import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';

Widget buttonBorderText(
    {required String title,
    double borderRadius = 5,
    Color borderColor = const Color.fromRGBO(33, 150, 243, 1),
    Color? highlightColor,
    Color? hoverColor,
    double borderWidth = 1,
    TextStyle? textStyle,
    EdgeInsetsGeometry? padding,
    required VoidCallback onClick}) {
  return InkWell(
    onTap: onClick,
    highlightColor: highlightColor ?? Colors.transparent,
    hoverColor: hoverColor ?? Colors.transparent,
    splashColor: Colors.transparent,
    borderRadius: BorderRadius.circular(borderRadius),
    child: Container(
      padding: padding ?? const EdgeInsets.all(4),
      decoration: BoxDecoration(
        border: Border.all(width: borderWidth, color: borderColor),
        borderRadius: BorderRadius.circular(borderRadius),
      ),
      child: Text(
        title,
        style: textStyle ?? const TextStyle(fontSize: 12, color: Colors.black),
      ),
    ),
  );
}

Widget buttonText(
    {required String title,
    Color? highlightColor,
    Color? hoverColor,
    TextStyle? textStyle,
    EdgeInsetsGeometry? padding,
    required VoidCallback onClick}) {
  return InkWell(
    onTap: onClick,
    highlightColor: highlightColor ?? Colors.transparent,
    hoverColor: hoverColor ?? Colors.transparent,
    splashColor: Colors.transparent,
    child: Container(
      padding: padding ?? const EdgeInsets.all(4),
      child: Text(
        title,
        style: textStyle ?? const TextStyle(fontSize: 12, color: Colors.black),
      ),
    ),
  );
}

Widget buttonBorderImage(
    {required String image,
    double width = 60,
    double height = 40,
    double borderRadius = 5,
    Color borderColor = Colors.blue,
    double borderWidth = 1,
    required VoidCallback onClick}) {
  return InkWell(
    onTap: onClick,
    splashColor: Colors.transparent,
    borderRadius: BorderRadius.circular(borderRadius),
    child: Container(
      decoration: BoxDecoration(
        border: Border.all(width: borderWidth, color: borderColor),
        borderRadius: BorderRadius.circular(borderRadius),
      ),
      child: ClipRRect(
        borderRadius: BorderRadius.circular(borderRadius - 1),
        child: Image.asset(
          image,
          width: width,
          height: height,
          fit: BoxFit.cover,
        ),
      ),
    ),
  );
}

Widget buttonImage(
    {required String image,
    double width = 60,
    double height = 40,
    double borderRadius = 0,
    required VoidCallback onClick}) {
  return InkWell(
    onTap: onClick,
    splashColor: Colors.transparent,
    borderRadius: BorderRadius.circular(borderRadius),
    child: ClipRRect(
      borderRadius: BorderRadius.circular(borderRadius - 1),
      child: Image.asset(
        image,
        width: width,
        height: height,
        fit: BoxFit.cover,
      ),
    ),
  );
}

Widget buttonBorderIconText(
    {required String title,
    required IconData icon,
    Color? iconColor,
    double borderRadius = 4,
    Color borderColor = Colors.blue,
    Color? highlightColor,
    Color? hoverColor,
    double borderWidth = 1,
    TextStyle? textStyle,
    EdgeInsetsGeometry? padding,
    required VoidCallback onClick}) {
  return InkWell(
    onTap: onClick,
    highlightColor: highlightColor ?? Colors.transparent,
    hoverColor: hoverColor ?? Colors.transparent,
    splashColor: Colors.transparent,
    borderRadius: BorderRadius.circular(borderRadius),
    child: Container(
      padding:
          padding ?? const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
      decoration: BoxDecoration(
        border: Border.all(width: borderWidth, color: borderColor),
        borderRadius: BorderRadius.circular(borderRadius),
      ),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisSize: MainAxisSize.min,
        children: [
          Icon(icon, size: 15, color: iconColor ?? borderColor),
          const Gap(2),
          Column(
            children: [
              Text(
                title,
                style: textStyle ??
                    const TextStyle(fontSize: 12, color: Colors.black),
              ),
              const Gap(2),
            ],
          ),
        ],
      ),
    ),
  );
}

Widget buttonIconText(
    {required String title,
    required IconData icon,
    Color? iconColor,
    double borderRadius = 4,
    Color? highlightColor,
    Color? hoverColor,
    double borderWidth = 1,
    TextStyle? textStyle,
    EdgeInsetsGeometry? padding,
    required VoidCallback onClick}) {
  return InkWell(
    onTap: onClick,
    highlightColor: highlightColor ?? Colors.transparent,
    hoverColor: hoverColor ?? Colors.transparent,
    splashColor: Colors.transparent,
    borderRadius: BorderRadius.circular(borderRadius),
    child: Container(
      padding:
          padding ?? const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisSize: MainAxisSize.min,
        children: [
          Icon(icon, size: 15, color: iconColor ?? Colors.blue),
          const Gap(2),
          Column(
            children: [
              Text(
                title,
                style: textStyle ??
                    const TextStyle(fontSize: 12, color: Colors.black),
              ),
              const Gap(2),
            ],
          ),
        ],
      ),
    ),
  );
}

Widget buttonImageText(
    {required String title,
    required String image,
    double width = 60,
    double height = 40,
    double borderRadius = 0,
    Color? borderColor,
    Color? highlightColor,
    Color? hoverColor,
    double borderWidth = 0,
    TextStyle? textStyle,
    EdgeInsetsGeometry? padding,
    required VoidCallback onClick}) {
  return InkWell(
    onTap: onClick,
    highlightColor: highlightColor ?? Colors.transparent,
    hoverColor: hoverColor ?? Colors.transparent,
    splashColor: Colors.transparent,
    borderRadius: BorderRadius.circular(borderRadius),
    child: Container(
      padding:
          padding ?? const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
      decoration: BoxDecoration(
        border: Border.all(
            width: borderWidth, color: borderColor ?? Colors.transparent),
        borderRadius: BorderRadius.circular(borderRadius),
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisSize: MainAxisSize.min,
        children: [
          Image.asset(
            image,
            width: width,
            height: height - 15,
            fit: BoxFit.cover,
          ),
          const Gap(2),
          Text(
            title,
            style:
                textStyle ?? const TextStyle(fontSize: 12, color: Colors.black),
          ),
        ],
      ),
    ),
  );
}
